Lean勉強会 2023-12-10
15:00~16:00
Introduction - Theorem Proving in Lean 4
タブロー計算
哲学演習 「論理学入門」 第 8 回
Dependent Type Theory - Theorem Proving in Lean 4
Lean is based on a version of dependent type theory known as the Calculus of Constructions, with a countable hierarchy of non-cumulative universes and inductive types
日本語訳: Leanは非累積的宇宙と帰納的型の可算階層を持つ、構成的計算として知られる依存型理論のバージョンに基づいている。
type universe in nLab
ここで言及されている宇宙(universe)はグロタンディーク宇宙ではなく型宇宙(type universe)?
Simple Type Theoryは単純型理論?
#xxxxxはコマンド
#checkコマンドは型を調べるやつ?
#evalコマンドで評価する
TypeはType 0の略である
#check TypeをするとType 0の型の型になって+1される
code:memo
#check Type --> Type : Type 1
#check Type 0 --> Type : Type 1
#check Type 1 --> Type : Type 2
universe uのようにuniverseコマンドを使いたくない場合は以下のような記法を使う
code:memo
def F.{u} (α : Type u) : Type u := Prod α α
#check F -- Type u → Type u
17:00~18:00
ProofWidgets4のコードリーディング
今日読んだのは以下
ProofWidgets4/ProofWidgets/Demos/Rubiks.lean at v0.0.3
ProofWidgets4/widget/src/rubiks.tsx at v0.0.3
ProofWidgets4/ProofWidgets/Demos/LazyComputation.lean at v0.0.3
ProofWidgets4/ProofWidgets/Compat.lean at v0.0.3
最新のコード: leanprover-community/ProofWidgets4 at 28046b1c0d70de55bc3ef33abef635ac4dc9a5ab
以下メモ
============================
ProofWidgets4/ProofWidgets/Demos/Rubiks.lean at v0.0.3
ProofWidgets4/widget/src/rubiks.tsx at v0.0.3
ProofWidgets4/ProofWidgets/Demos/LazyComputation.lean at v0.0.3
LazyComputationはそのまま訳すと遅延計算
lctxはlocal context
MetaM: メタ変数のモナド?
RPCに関係がありそう
JSON-RPC - Wikipedia
LazyComputation.lean#L54
ContextInfo.save
code:src/lean/Lean/Elab/InfoTree/Main.lean
def save MonadFileMap m : m ContextInfo := do
let ctx ← saveNoFileMap
return { ctx with fileMap := (← getFileMap) }
end ContextInfo
lean4/src/Lean/Elab/InfoTree/Main.lean at master · leanprover/lean4
Lean 4は正格評価の言語
LazyComputation.lean#L27
runnerWidget
mkprocsコマンド?でRpcEncodableになっている
mkrpcenc#L45-L53
関連: 継続渡しスタイル、イベント駆動, React
LazyComputation.lean#L22
RunnerWidgetPropsは19行目で#mkrpcencコマンドで定義されている
code:memo
-- Make it possible for widgets to receive RunnerWidgetProps. Uses the TypeName instance.
#mkrpcenc RunnerWidgetProps
ProofWidgets4/ProofWidgets/Compat.lean at v0.0.3
型クラス
Compat.lean#L25-L27
instance : RpcEncodable (LazyEncodable Json)が定義されている
Compat.lean#L124
structureの型がRpcEncodableと定義しているっぽい
#コードリーディング
#勉強会参加メモ